package ch02;

public class TestMain_237 {

    public static void main (String[] srgs){
        // 5位同学的成绩
        int[] ns = new int[5];
        ns[0] = 68;
        ns[1] = 79;
        ns[2] = 91;
        ns[3] = 85;
        ns[4] = 62;
        System.out.println(ns.length);

        // 简写
        int[] ns1 = new int[] {68,79,91,85,62};
        System.out.println(ns1.length);

        // 进一步简写
        int[] ns2 = {68,79,91,85,62};
        System.out.println(ns2.length);

        // 5位同学的成绩:
        int[] nss;
        nss = new int[] { 68, 79};  //, 91, 85, 62
        System.out.println(nss.length); // 5
        nss = new int[] { 1, 2, 3 };
        System.out.println(nss.length); // 3

        //字符串数组
//        String[] name = { "ABC", "XYZ", "zoo"};
//        System.out.println(name[1]);
//        name[1] = "cat";
//        System.out.println(name[1]);

        String[] names = {"ABC", "XYZ", "zoo"};
        String s = names[1];
        names[1] = "cat";
        System.out.println(s); // s是"XYZ"还是"cat"?
    }
}
